package com.homework;

import java.util.Objects;

public class BaconPizza extends Pizza {
    /**
     * 克数
     */
    private double grams;
    public BaconPizza() {
    }

    public BaconPizza(double grams) {
        this.grams = grams;
    }

    public BaconPizza(String name, double price, double size, double grams) {
        super(name, price, size);
        this.grams = grams;
    }

    public double getGrams() {
        return grams;
    }

    public void setGrams(double grams) {
        this.grams = grams;
    }

    @Override
    public void show() {
        super.show();
        System.out.println("克数"+this.grams);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        BaconPizza that = (BaconPizza) o;
        return Double.compare(that.grams, grams) == 0;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), grams);
    }
}
